package com.cupster.func_db_litepal.entity;

import org.litepal.annotation.Column;
import org.litepal.crud.LitePalSupport;

import java.util.ArrayList;
import java.util.List;

//litepal step5
public class User extends LitePalSupport {

    @Column(index =  true)//这个注释不会影响id列,测试验证
    private long id ;
    @Column(unique = true ,defaultValue = "-")
    private String name;
    private int age;
    private String account;
    private String password;


    private List<Article> readHis  = new ArrayList<>();

    public boolean save(){
        return super.save();
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public List<Article> getReadHis() {
        return readHis;
    }

    public void setReadHis(List<Article> readHis) {
        this.readHis = readHis;
    }

    public void addReadHis(Article article){
        this.readHis.add(article);
    }
}
